// module.exports = {
//   configureWebpack: {
//
//     // 配置文件目录别名
//     resolve: {
//       alias: {
//         'components': '@/components',
//         'content': '@/components/content',
//         'common': '@/components/common',
//         'assets': '@/assets',
//         'network': '@/network',
//         'views': '@/views',
//       }
//     }
//   }
// };

const path = require('path');  //引入path模块
function resolve(dir) {
  return path.join(__dirname, dir)  //path.join(__dirname)设置绝对路径
}

module.exports = {

  chainWebpack: (config) => {
    config.resolve.alias
      .set('@', resolve('./src'))
      .set('components', resolve('./src/components'))   //set第一个参数：设置的别名，第二个参数：设置的路径
      .set('network', resolve('./src/network'))
      .set('views', resolve('./src/views'))
      .set('assets', resolve('./src/assets'))
      .set('common', resolve('./src/common'))
      // .set('content', resolve('./src/components/content'))
      // .set('common', resolve('./src/components/common'))
  },

  // 接口代理设置
  devServer: {
    proxy: {
      '/api': {
        target: 'https://www.xxx.com', //目标路径，别忘了加http和端口号
        changeOrigin: true, //是否跨域
        ws: true,
        pathRewrite: {
          '^/api': '' //重写路径
        }
      }
    }
  }
};


//https://segmentfault.com/a/1190000012948175?utm_source=tag-newest
//https://segmentfault.com/a/1190000019122005?utm_source=sf-related#item-2-8
// https://zhuanlan.zhihu.com/p/26260061
const cdn = {
  css: [
    // element-ui css
    'https://unpkg.com/element-ui/lib/theme-chalk/index.css'
  ],
  js: [
    // element-ui js
    'https://unpkg.com/element-ui/lib/index.js'
  ]
};
